#define _CRT_SECURE_NO_WARNINGS 1


int Binarysearch(int* arr, int n)
{
    int  left = 0;
    int  right = n - 1;
    if (arr[left] < arr[right])
    {
        return 0;
    }
    while (left != right - 1)
    {
        int mid = (left + right) / 2;
        if (arr[mid] > arr[right])
        {
            left = mid;
        }
        else {
            if (arr[mid] < arr[right])
            {
                right = mid;
            }
            else {
                --right;
            }
        }
    }
    return right;
}

int minNumberInRotateArray(int* nums, int numsLen) {
    // write code here
    return nums[Binarysearch(nums, numsLen)];
}